<?php
class BaseController
{
    protected $conf;
    protected $http_method;
    protected $input;
    protected $m;
    protected $output = array(
        'http' => array(
            'status_code' => 200,
            'content-type' => 'text/html',
        ),
        'tpl' => '',
        'data' => array(),
    );
    protected $uri;
    protected function __construct($uri)
    {
        $this->conf = new ConfLib();
        $this->uri  = $uri;
        $this->http_method = strtolower($_SERVER['REQUEST_METHOD']);
        switch($this->http_method) {//todo cookie
            case 'get' :
                $this->input = $_GET;
                break;
            case 'post' :
                $this->input = $_POST;
                break;
            case 'put' :
                $this->input = file_get_contents('php://input');
                break;
        }
    }

    protected function checkParams($data)
    {
        foreach($data as $one) {
            if(!isset($this->input[$one])) {
                throw new HttpException();
            }
        }
    }
}
?>
